Repository navigation
fix: keep AI command running when the popup is closed - #1739
Merged
jasoncoffman merged 3 commits intoOct 29, 2026
Merged
jasoncoffman merged 3 commits into
jasoncoffman merged 3 commits into
Conversation
Closing the AI command popup while text-to-SQL is running now leaves the request running in the background. When it finishes, a toast offers to reopen the result. Each AI socket request now carries a client-generated request_id that the server echoes on every event. useAISocket drops events for any other id, so late responses from cancelled or superseded requests are ignored. Command errors are sent on the command's own channel, tagged with the request_id. useAISocket also keeps a stable handler identity and clears existing listeners before emitting. Before, callers that passed an inline onData could leak a listener or handle each event twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasoncoffman
self-requested a review
October 26, 2026 21:49
jasoncoffman
previously approved these changes
Oct 28, 2026
A data doc can now hold many AI command hooks, so clear each hook's listeners when its component unmounts instead of leaving them on the shared socket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Custom AIWebSocket plugins, and servers still on the old version during a rolling deploy, send events without a request_id. Handle those events as before instead of dropping them; only events tagged with a different request_id are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasoncoffman
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closing the AI command popup while text-to-SQL is running now leaves the request running in the background. When it finishes, a toast offers to reopen the result.
Each AI socket request now carries a client-generated
request_idthat the server echoes on every event.useAISocketignores events tagged with a differentrequest_id, so late responses from cancelled or superseded requests no longer show up in a reopened or re-run command. Events with norequest_idare handled as before, so customAIWebSocketplugins and servers still on the old version during a rolling deploy keep working. Command errors are sent on the command's own channel, tagged with therequest_id.useAISocketalso keeps a stable handler identity, clears existing listeners before emitting, and removes its listeners on unmount. Before, callers that passed an inlineonDatacould leak a listener or handle each event twice.Testing
useAISockettests cover: stale events ignored, events without arequest_idstill handled, each event handled once when emitting over an in-flight request, no leaked listeners after re-render or unmount.sql_titleevents are tagged with therequest_id, and that a failure sendserrorthencloseon the command's channel.make testpasses (pytest, tsc, Jest, ESLint, webpack).